<template>
  <div class="main">
    <div class="top">
      <img :src="applyData.contentImg" alt />
    </div>
    <div class="middle">
      <p>{{applyData.name}}</p>
      <span>报名日期：{{applyData.registerStartTime}}至{{applyData.registerEndTime}}</span>
    </div>
    <div class="bottom">
      <ul>
        <li>
          <i
            class="iconfont iconhuodongzhuangtai"
            style="margin-right:6px;color: rgba(107, 107, 107, 1);"
          ></i>
          <div>
            <span>活动状态：</span>
            <span
              class="status"
            >{{applyData.activityStatus==='NOT_START'?'未开始': applyData.activityStatus==='ON_REGISTER'?"报名中":applyData.activityStatus==='REGISTER_END'?"报名结束":applyData.activityStatus==='ONGOING'?"进行中":"活动结束"}}</span>
          </div>
        </li>
        <li>
          <i
            class="iconfont iconhuodongshijian"
            style="margin-right:6px;color: rgba(107, 107, 107, 1);"
          ></i>
          <div>
            <span>报名时间：</span>
            <span class="status">{{partTime}}</span>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { activeDetail } from '@/api/api';
export default {
  props: {},
  data () {
    return {
      applyData: {},
      partTime: ''
    };
  },
  computed: {},
  created () {},
  mounted () {
    this.getActiveDetail(this.$mp.query.classifyId);
    // 将时间戳转换用户报名时间的方法
    let utils = require('@/utils/time.js');
    this.formatDate = utils.default.formatDate;
  },
  watch: {},
  methods: {
    // 获取报名详情信息
    async getActiveDetail (id) {
      await activeDetail(id).then(res => {
        const activity = res.activity;
        activity.registerStartTime = activity.registerStartTime.substring(
          0,
          10
        );
        activity.registerEndTime = activity.registerEndTime.substring(0, 10);
        // console.log('报名详情', activity);
        this.applyData = activity;
        // console.log(res.partTime);
        if (res.partTime) {
          this.partTime = this.formatDate(res.partTime, 'yyyy-MM-dd hh:mm:ss');
          // console.log(this.partTime);
        }
      });
    }
  },
  components: {}
};
</script>

<style scoped lang="less">
.main {
  padding: 0 15px;
  .top {
    padding: 25px 0 15px;
    width: 345px;
    height: 180px;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0px 0px 20px 0px rgba(2, 6, 4, 0.06);
    border-radius: 2px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .middle {
    border-bottom: 1px solid rgba(230, 230, 230, 1);
    padding-bottom: 20px;
    margin-bottom: 21px;
    p {
      font-size: 18px;
      font-family: PingFangSC-Medium, PingFangSC;
      font-weight: 700;
      color: rgba(2, 6, 4, 1);
      line-height: 25px;
      margin-bottom: 8px;
    }
    span {
      font-size: 13px;
      font-family: PingFangSC-Regular, PingFangSC;
      font-weight: 400;
      color: rgba(153, 153, 153, 1);
      line-height: 18px;
    }
  }
  .bottom {
    li {
      display: flex;
      margin-bottom: 15px;
      align-items: center;
      span {
        font-size: 14px;
        font-family: PingFangSC-Medium, PingFangSC;
        font-weight: 700;
        color: rgba(2, 6, 4, 1);
        line-height: 20px;
      }
      .status {
        color: #6b6b6b;
        font-weight: 400;
      }
    }
  }
}
</style>
